package complex.java.serialize;

import com.thoughtworks.xstream.XStream;

public class XStreamSerializable implements ISerializable {
	static final XStream xstream = new XStream();

	@Override
	public void serialize(Order order) throws Exception {
		System.out
				.println("=================XStreamSerializable=========================");
		long start = System.currentTimeMillis();
		String str = xstream.toXML(order);
		long serialize = System.currentTimeMillis();

		Order order1 = (Order) xstream.fromXML(str);
		long deSerialize = System.currentTimeMillis();
		// System.out.println(order1);
		System.out.println("serialize:" + (serialize - start));
		System.out.println("deSerialize:" + (deSerialize - serialize));
	}
}
